<template>
  <div class="order-statistics">
    <div class="order-statistics__select">
      <div class="order-statistics__select-date">
        <el-date-picker
          v-model="dayTime"
          type="month"
          :clearable="false"
          size="mini"
          value-format="yyyy-MM"
          format="yyyy年M月"
          @change="getData">
        </el-date-picker>
      </div>
    </div>
    <div class="order-statistics__content">
      <div class="item title">
        <span></span>
        <span>报修派单及时率</span>
        <span>报修接单及时率</span>
        <span>报事完成及时率</span>
        <span style="line-height: 35px">满意率</span>
      </div>
      <div v-for="(item,i) in data" :key="i" class="item">
        <span>{{item.cityName}}</span>
        <span class="green" :class="{redActive: item.bxpdjsl < 85 ? true : false}">{{item.bxpdjsl + '%'}}</span>
        <span class="green" :class="{redActive: item.bxjdl < 85 ? true : false}">{{item.bxjdl + '%'}}</span>
        <span class="green" :class="{redActive: item.bswcl < 85 ? true : false}">{{item.bswcl + '%'}}</span>
        <span class="green" :class="{redActive: item.myl < 85 ? true : false}">{{item.myl + '%'}}</span>
      </div>
    </div>
  </div>
</template>
<script>
import { Select, Option, DatePicker } from 'element-ui'
import { getKhfwDetailRate } from 'src/api/api'
import { formatDate } from 'js/utils'
export default {
  components: {
    [Select.name]: Select,
    [Option.name]: Option,
    [DatePicker.name]: DatePicker,
  },
  data() {
    return {
      dayTime: formatDate('yyyy-mm', new Date()),
      data: []
    }
  },
  mounted() {
    this.getData()
  },
  methods: {
    getData() {
      const params = {
        dayTime: this.dayTime
      }
      getKhfwDetailRate(params).then(res=> {
        this.data = res.data
      })
    }
  },
}
</script>
<style lang="scss">
.order-statistics {
  padding: 10px 0px 20px;
  &__select {
    text-align: right;
    padding: 5px 20px 5px 0;
    font-size: 14px;
    .el-select, .el-date-editor {
      .el-input__inner {
        border: 0;
        border-radius: 0;
        background:rgba(11,21,58,1);
        box-shadow:1px 1px 0px 0px rgba(255,255,255,0.25), 0px 2px 4px 0px rgba(0, 0, 0, 1);
        color: #AAECFF;
        font-size: 14px;
      }
      .el-input__icon {
        color: #AAECFF;
        font-size: 14px;
      }
    }
    &-date {
      margin-right: 20px;
      .el-date-editor {
        width: 135px;
      }
    }
  }
  .green {
    color: #5BDA75;
  }
  .redActive {
    color: #F898A7;
  }
  &__content {
    display: flex;
    align-items: center;
    justify-content: center;
    align-content: center;
    // height: 150px;
    width: 100%;
    .item {
      display: flex;
      flex-direction: column;
      align-items: center;
      align-content: center;
      // width: 7%;
      // height: 150px;
      span {
        display: block;
        border: 0.5px solid #6A97AA;
        width: 40px;
        height: 35px;
        line-height: 35px;
        font-size: 12px;
        // color: #6A97AA;
        text-align: center;
        // padding-top: 10px;
        // vertical-align: middle;
      }
    }
    .title {
      span {
        // padding-top: 5px;
        width: 55px;
        line-height: 15px;
        // height: 35px;
      }
    }
  }
}
</style>